#!/bin/bash

  cp /mnt/rootfs/stuff/ssh/usr/sbin/sshd /mnt/OSBoot/usr/sbin/sshd
  cp /mnt/rootfs/stuff/ssh/System/Library/LaunchDaemons/ssh.plist /mnt/OSBoot/System/Library/LaunchDaemons/ssh.plist
  cp /mnt/rootfs/stuff/ssh/usr/bin/ssh /mnt/OSBoot/usr/bin/ssh
  cp /mnt/rootfs/stuff/ssh/usr/bin/ssh-add /mnt/OSBoot/usr/bin/ssh-add
  cp /mnt/rootfs/stuff/ssh/usr/bin/ssh-agent /mnt/OSBoot/usr/bin/ssh-agent
  cp /mnt/rootfs/stuff/ssh/usr/bin/ssh-keygen /mnt/OSBoot/usr/bin/ssh-keygen
  cp /mnt/rootfs/stuff/ssh/usr/bin/ssh-keyscan /mnt/OSBoot/usr/bin/ssh-keyscan
  cp /mnt/rootfs/stuff/ssh/usr/bin/scp /mnt/OSBoot/usr/bin/scp
  cp /mnt/rootfs/stuff/ssh/usr/libexec/sftp-server /mnt/OSBoot/usr/libexec/sftp-server
  cp /mnt/rootfs/stuff/ssh/usr/libexec/ssh-keysign /mnt/OSBoot/usr/libexec/ssh-keysign
  cp /mnt/rootfs/stuff/ssh/usr/libexec/sshd-keygen-wrapper /mnt/OSBoot/usr/libexec/sshd-keygen-wrapper

  mkdir -p /mnt/OSBoot/System/Library/Frameworks/OSXFrames
  cp -pr /mnt/rootfs/stuff/ssh/System/Library/Frameworks/Kerberos.framework /mnt/OSBoot/System/Library/Frameworks/OSXFrames/.
  sed -i"" -e 's;^exec;DYLD_FRAMEWORK_PATH="/System/Library/Frameworks/OSXFrames" exec;' /mnt/OSBoot/usr/libexec/sshd-keygen-wrapper

  chown 0:0 /mnt/OSBoot/usr/sbin/sshd
  chown 0:0 /mnt/OSBoot/System/Library/LaunchDaemons/ssh.plist
  chown 0:0 /mnt/OSBoot/usr/bin/ssh
  chown 0:0 /mnt/OSBoot/usr/bin/ssh-add
  chown 0:0 /mnt/OSBoot/usr/bin/ssh-agent
  chown 0:0 /mnt/OSBoot/usr/bin/ssh-keygen
  chown 0:0 /mnt/OSBoot/usr/bin/ssh-keyscan
  chown 0:0 /mnt/OSBoot/usr/bin/scp
  chown 0:0 /mnt/OSBoot/usr/libexec/sftp-server
  chown 0:0 /mnt/OSBoot/usr/libexec/ssh-keysign
  chown 0:0 /mnt/OSBoot/usr/libexec/sshd-keygen-wrapper
  chown -R 0:0 /mnt/OSBoot/System/Library/Frameworks/OSXFrames/Kerberos.framework

  chmod 755 /mnt/OSBoot/usr/sbin/sshd
  chmod 755 /mnt/OSBoot/System/Library/LaunchDaemons/ssh.plist
  chmod 755 /mnt/OSBoot/usr/bin/ssh
  chmod 755 /mnt/OSBoot/usr/bin/ssh-add
  chmod 755 /mnt/OSBoot/usr/bin/ssh-agent
  chmod 755 /mnt/OSBoot/usr/bin/ssh-keygen
  chmod 755 /mnt/OSBoot/usr/bin/ssh-keyscan
  chmod 755 /mnt/OSBoot/usr/bin/scp
  chmod 755 /mnt/OSBoot/usr/libexec/sftp-server
  chmod 4755 /mnt/OSBoot/usr/libexec/ssh-keysign
  chmod 755 /mnt/OSBoot/usr/libexec/sshd-keygen-wrapper
  chmod -R 755 /mnt/OSBoot/System/Library/Frameworks/OSXFrames/Kerberos.framework


